package com.travel.mapper;

import com.travel.common.Result;
import com.travel.domain.VO.ProductVO;
import com.travel.domain.entity.Category;
import com.travel.domain.entity.Product;
import com.travel.domain.entity.ProductInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper {

    @Select("SELECT * FROM product WHERE category_id = #{categoryId}")
    List<Product> selectProductsByCategoryId(Long categoryId);

    @Select("SELECT * FROM category")
    List<Category> selectAllCategories(); // 查询所有分类

    @Select("select * from product_info where product_id = #{productId}")
    ProductInfo selectProductById(Long productId);

    // 查询商品的图片列表
    @Select("SELECT src FROM product_images WHERE product_id = #{productId}")
    List<String> selectImagesByProductId(Long productId);
}
